<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<title>我的优惠卷</title>
<link rel="stylesheet" type="text/css" href="/style/css/base.css"/>
<link rel="stylesheet" type="text/css" href="/style/css/swiper.min.css"/>
<link rel="stylesheet" type="text/css" href="/style/css/xshop.css?ver=20170916" />
<link rel="stylesheet" type="text/css" href="/style/css/fu.shop.css"/>
<script src="/style/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="/style/js/swiper.min.js" type="text/javascript" charset="utf-8"></script>
<script src="/style/js/xShop.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="/style/js/sweet-alert.min.js"></script>
<link type="text/css" rel="stylesheet" href="/style/css/sweet-alert.css">
<link href="/style/css/dropload.css" rel="stylesheet">
<script src="/style/js/dropload.js"></script>
<style>
.outer{position:absolute;left:0;width:100%;height:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;-webkit-box-orient:vertical;box-orient:vertical;-webkit-flex-direction:column;flex-direction:column}
.inner{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;background-color:#f1f1f1;overflow-y:scroll;-webkit-overflow-scrolling:touch; margin-bottom: 1.2rem;}
.inner.iPhoneX
{
    margin-bottom: 1.6rem;
}
.opacity{-webkit-animation:opacity .3s linear;animation:opacity .3s linear}
@-webkit-keyframes opacity{0%{opacity:0}
100%{opacity:1}
}
@keyframes opacity{0%{opacity:0}
100%{opacity:1}
}
.popmask{position:fixed;width:100%;height:100%;background:rgba(0,0,0,.8);left:0;top:0;z-index:999;display: none;}
.popexp{position:fixed;width:80%;height:70%;padding:10% 5%;left:5%;top:5%;background:#fff;z-index:1000;overflow-x:hidden;overflow-y:auto;display: none;}
.popexp .name{float:left;width:100%;height:auto;color:#999;padding-bottom:.3rem;line-height:.4rem;font-size:.26rem;border-bottom:1px solid #ccc;margin-bottom:.5rem}
.popexp ul{float:left;width:100%;height:auto;list-style:none}
.popexp ul li{border-left:1px solid #ccc;height:auto;background:#fff;color:#999;float:left;width:80%;padding-left:.5rem;font-size:.26rem}
.popexp ul li div{position:absolute;width:.2rem;height:.2rem;border-radius:.2rem;background:#ccc;left:.28rem}
.popexp ul li.curr{color:#73C887}
.popexp ul li.curr div{position:absolute;width:.25rem;height:.25rem;border-radius:.25rem;background:#73C887;border:.05rem solid #D1ECD9;left:.22rem}
.popexp ul li p{padding-top:.2rem}
.popexp ul li i{float:left;width:100%;height:1px;background:#ccc;margin:.2rem 0}
.popclose{position: fixed; bottom: 1rem; text-align: center; width: 100%; height: .5rem; z-index: 1000; display: none;}
.popclose img{width: auto; height: .8rem;}
</style>
</head>
<body>
<div class="outwrap">


    <div class="meinner-adr-add ">
    <div class="cou-header cou-nav">
      <div class="me-myor">
        <ul class="clearfix">
           <li class="on coupon_list" data-type="0"><a href="javascript:;"><i class="ico"><?php if($this->coupon['coupon_total']>0):?><em style="left:85%;top:11px;"><?=$this->coupon['coupon_total'];?></em><?php endif;?></i><p>全部</p></a></li>
           <li  class="coupon_list" data-type="1"><a href="javascript:;"><i class="ico"><?php if($this->coupon['coupon_unused']>0):?><em style="left:85%;top:11px;"><?=$this->coupon['coupon_unused'];?></em><?php endif;?></i><p>未使用</p></a></li>
           <li  class="coupon_list" data-type="2"><a href="javascript:;"><i class="ico"><?php if($this->coupon['coupon_used']>0):?><em style="left:85%;top:11px;"><?=$this->coupon['coupon_used'];?></em><?php endif;?></i><p>已使用</p></a></li>
           <li  class="coupon_list" data-type="5"><a href="javascript:;"><i class="ico"><?php if($this->coupon['coupon_past']>0):?><em style="left:85%;top:11px;"><?=$this->coupon['coupon_past'];?></em><?php endif;?></i><p>已过期</p></a></li>
        </ul>
      </div>
    </div>
    <?php if(empty($this->data['data'])):?>
      <div class="order-none">
        <i class="ico"><img src="/style/images/catkong-4.png"/></i>       
        <p class="p1">您还没有优惠卷！</p> 
      </div>
      <?php else:?>
        <div class="outer cou-main box-top">
         <div class="inner">
         <div id="thelist">
          <?php foreach($this->data['data'] as $v):?>
        <div class="cou-list">
      <div class="bh"><p><?=$v['type_price']?></p>
      </div>
      <div class="info">
        <dl><dt>状态：</dt><dd class="state">
        	<span>
        	
        			<?=$v['status']?>
        			
        	</span>
        </dd></dl>
        <dl><dt>创建时间：<?=$v['create_time']?></dt></dl>
      <dl><dt>到期时间：<?=$v['expire_time']?></dt></dl>
         <?php if($v['used_time']){?>
      <dl><dt>使用时间：<?=$v['used_time']?></dt></dl>
      <?php }?>
      </div>
    </div>
      <?php endforeach;?>
      </div>
      </div>
      </div>
      <?php endif;?>
  </div>
  

</div>
<div class="popmask"></div>
<div class="popexp">
  <div class="name">--</div>
  <ul></ul>
</div>
<div class="popclose"><img src="/style/images/close.png"></div>

<!--底部导航-->
<!-- <div class="foot-menu" style="display: block;">
    <ul class="clearfix">
        <li><a href="/index/index"><i class="ico-1"></i><span>首页</span></a></li>
        
        <li><a href="/cart/cart"><i class="ico-5"></i><span>购物车</span></a></li>
        <li><a href="#"><i class="ico-3"></i><span>客服</span></a></li>
        <li class="on"><a href="/user/index"><i class="ico-4"></i><span>我的</span></a></li>
    </ul>
</div> -->

</body>

<script>
$('.coupon_list').click(function() {
   
    _type = $(this).attr('data-type');
    $('.coupon_list').removeClass('on');
    $(this).addClass('on');
    order_ajax();
})

function order_ajax() {
    $.ajax({
        type: "get",
        url: "/user/coupon",
        data: {
            "type": _type,
            "mr": Math.random(),
            "act": "ajax"
        },
        async: false,
        dataType: 'json',
        success: function(data) {
            shtml = "";
           
            if (data.data.length > 0) {
                $(data.data).each(function(i, v) {
                   var used_time='';
                      if(v.used_time !=0){
                    	   used_time = '<dl><dt>使用时间：'+v.used_time+'</dt></dl>';
                          }
                      	
               	     shtml += '<div class="cou-list"><div class="bh"><p>'+v.type_price+'</p></div>';
                	 shtml += '<div class="info"><dl><dt>状态：</dt><dd class="state"><span>'+v.status+'</span></dd></dl>';
                	 shtml += '<dl><dt>创建时间：'+v.create_time+'</dt></dl><dl><dt>到期时间：'+v.expire_time+'</dt></dl>';
                	 shtml += used_time+'</div></div>';
                	
           
                   
                });
                $("#thelist").html(shtml);
               
            } else {
                var htmlss = '';
               // htmlss += '<div class="order-none"> <i class="ico"><img src="/style/images/catkong-4.png"/></i><p class="p1">您还没有优惠卷！</p></div>';
                $("#thelist").html(htmlss);
            }
        }
    });
}
</script>
</html>